package model.pojo;
// Generated Sep 3, 2012 11:51:00 PM by Hibernate Tools 3.2.1.GA


import java.util.Date;
import java.util.HashSet;
import java.util.Set;
import javax.persistence.CascadeType;
import javax.persistence.Column;
import javax.persistence.Entity;
import javax.persistence.FetchType;
import javax.persistence.Id;
import javax.persistence.JoinColumn;
import javax.persistence.ManyToOne;
import javax.persistence.OneToMany;
import javax.persistence.Table;
import javax.persistence.Temporal;
import javax.persistence.TemporalType;

/**
 * HoaDon generated by hbm2java
 */
@Entity
@Table(name="hoa_don"
    ,schema="public"
)
public class HoaDon  implements java.io.Serializable {


     private int maHoaDon;
     private TinhTrangHd tinhTrangHd;
     private NhanVien nhanVien;
     private KhachHang khachHang;
     private String idHoaDon;
     private Integer soLuong;
     private Double tongTien;
     private Date ngayThanhToan;
     private Set<ChiTietPt> chiTietPts = new HashSet<ChiTietPt>(0);
     private Set<ChiTietHd> chiTietHds = new HashSet<ChiTietHd>(0);

    public HoaDon() {
    }

	
    public HoaDon(int maHoaDon) {
        this.maHoaDon = maHoaDon;
    }
    public HoaDon(int maHoaDon, TinhTrangHd tinhTrangHd, NhanVien nhanVien, KhachHang khachHang, String idHoaDon, Integer soLuong, Double tongTien, Date ngayThanhToan, Set<ChiTietPt> chiTietPts, Set<ChiTietHd> chiTietHds) {
       this.maHoaDon = maHoaDon;
       this.tinhTrangHd = tinhTrangHd;
       this.nhanVien = nhanVien;
       this.khachHang = khachHang;
       this.idHoaDon = idHoaDon;
       this.soLuong = soLuong;
       this.tongTien = tongTien;
       this.ngayThanhToan = ngayThanhToan;
       this.chiTietPts = chiTietPts;
       this.chiTietHds = chiTietHds;
    }
   
     @Id 
    
    @Column(name="ma_hoa_don", unique=true, nullable=false)
    public int getMaHoaDon() {
        return this.maHoaDon;
    }
    
    public void setMaHoaDon(int maHoaDon) {
        this.maHoaDon = maHoaDon;
    }
@ManyToOne(fetch=FetchType.LAZY)
    @JoinColumn(name="ma_tinh_trang_hd")
    public TinhTrangHd getTinhTrangHd() {
        return this.tinhTrangHd;
    }
    
    public void setTinhTrangHd(TinhTrangHd tinhTrangHd) {
        this.tinhTrangHd = tinhTrangHd;
    }
@ManyToOne(fetch=FetchType.LAZY)
    @JoinColumn(name="ma_nhan_vien")
    public NhanVien getNhanVien() {
        return this.nhanVien;
    }
    
    public void setNhanVien(NhanVien nhanVien) {
        this.nhanVien = nhanVien;
    }
@ManyToOne(fetch=FetchType.LAZY)
    @JoinColumn(name="ma_khach_hang")
    public KhachHang getKhachHang() {
        return this.khachHang;
    }
    
    public void setKhachHang(KhachHang khachHang) {
        this.khachHang = khachHang;
    }
    
    @Column(name="id_hoa_don", length=6)
    public String getIdHoaDon() {
        return this.idHoaDon;
    }
    
    public void setIdHoaDon(String idHoaDon) {
        this.idHoaDon = idHoaDon;
    }
    
    @Column(name="so_luong")
    public Integer getSoLuong() {
        return this.soLuong;
    }
    
    public void setSoLuong(Integer soLuong) {
        this.soLuong = soLuong;
    }
    
    @Column(name="tong_tien", precision=17, scale=17)
    public Double getTongTien() {
        return this.tongTien;
    }
    
    public void setTongTien(Double tongTien) {
        this.tongTien = tongTien;
    }
    @Temporal(TemporalType.TIMESTAMP)
    @Column(name="ngay_thanh_toan", length=29)
    public Date getNgayThanhToan() {
        return this.ngayThanhToan;
    }
    
    public void setNgayThanhToan(Date ngayThanhToan) {
        this.ngayThanhToan = ngayThanhToan;
    }
@OneToMany(cascade=CascadeType.ALL, fetch=FetchType.LAZY, mappedBy="hoaDon")
    public Set<ChiTietPt> getChiTietPts() {
        return this.chiTietPts;
    }
    
    public void setChiTietPts(Set<ChiTietPt> chiTietPts) {
        this.chiTietPts = chiTietPts;
    }
@OneToMany(cascade=CascadeType.ALL, fetch=FetchType.LAZY, mappedBy="hoaDon")
    public Set<ChiTietHd> getChiTietHds() {
        return this.chiTietHds;
    }
    
    public void setChiTietHds(Set<ChiTietHd> chiTietHds) {
        this.chiTietHds = chiTietHds;
    }




}


